﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data.Entity;
using ZX.OA.Model;

namespace ZX.OA.DAL
{
    public class TaskInfoDal
    {
        Entity entity = new Entity();
        /// <summary>
        /// 显示工作任务
        /// </summary>
        /// <returns></returns>
        public List<TaskInfo> GetTaskList()
        {
            return entity.TaskInfo.ToList();
        }
        /// <summary>
        /// 添加工作任务
        /// </summary>
        /// <param name="t"></param>
        /// <returns></returns>
        public int TaskAdd(TaskInfo t)
        {
            entity.TaskInfo.Add(t);
            return entity.SaveChanges();
        }
        /// <summary>
        /// 删除工作任务
        /// </summary>
        /// <param name="t"></param>
        /// <returns></returns>
        public int Dele(int id)
        {
            entity.TaskInfo.Remove(entity.TaskInfo.Find(id));
            return entity.SaveChanges();
        }
        /// <summary>
        /// 工作任务的详情
        /// </summary>
        /// <param name="t"></param>
        /// <returns></returns>
        public TaskInfo TaskSreach(int id)
        {
            return entity.TaskInfo.Find(id);
         
        }
    }
}
